CREATE VIEW (dynamically) - Mailing list pgsql-sql

From Emmanuel Engelhart
Subject CREATE VIEW (dynamically)
Date
Msg-id 20021109145211.260cb84f.Emmanuel Engelhart@rack
Whole thread Raw
List pgsql-sql
code
<<
CREATE FUNCTION "requests_insert_after" () RETURNS opaque AS '
DECLAREview_name    text;
BEGINview_name := ''request_'' || NEW.id;CREATE VIEW view_name AS select * from groups;return NEW;
END' LANGUAGE 'plpgsql';

CREATE TRIGGER "requests_insert_after" AFTER INSERT ON "requests"  FOR EACH ROW
EXECUTE PROCEDURE "requests_insert_after" ();>>

This code after an insertion on table "requests" give me this message :
<<
PostgreSQL said: ERROR: parser: parse error at or near "$1" 
>>

Why ?

Thx for any help.

Emmanuel Engelhart


pgsql-sql by date:

Previous
From: Richard Huxton
Date:
Subject: Re:
Next
From: "LR"
Date:
Subject: execute a query in an other db